//
//  Bed+DoesBedContainIncompatiblePlant.m
//  PlotMate
//
//  Created by Brian Boyle on 18/04/2012.
//  Copyright (c) 2012 Brian Boyle. All rights reserved.
//

#import "Bed+DoesBedContainIncompatiblePlant.h"
#import "PlotIncompatibilty.h"

@implementation Bed (DoesBedContainIncompatiblePlant)

/*Get a plot Incompatibility from if one exists for that plant*/
-(PlotIncompatibilty *) getIncompatibility:(Plant *)plant
{
    for (PlotIncompatibilty *incomp in self.incompatibilities) {
        if([incomp.plant1 isEqualToString:plant.name]){
            return incomp;
            break;
        }
    }
    return nil;
}

/*Delete an incompatibility for a specific plant*/
-(NSMutableArray *) getPlotIncompatibilitiesToDelete:(Plant *)plant
{
    NSMutableArray *incompsToDelete = [[NSMutableArray alloc] init];
    for (PlotIncompatibilty *incomp in self.incompatibilities) {
        if([incomp.plant1 isEqualToString:plant.name] || [incomp.plant2 isEqualToString:plant.name]){
            [incompsToDelete addObject:incomp];
        }
    }
    return incompsToDelete;
}
@end
